﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using hospital_registration_system.BLL;
using hospital_registration_system.Entity;

namespace hospital_registration_system.Utility
{
    /// <summary>
    /// 所有医生管理功能的类
    /// </summary>
    public class ManagerDoctor
    {
        protected static DoctorService service = new DoctorService();

        /// <summary>
        /// 查询所有的医生
        /// </summary>
        /// <returns>返回医生的信息链表</returns>
        public static List<Doctor> getAllDoctor()
        {

            return service.selectAllDoctors();
        }

        /// <summary>
        /// 删除指定id的医生
        /// </summary>
        /// <param name="id">要删除的医生id</param>
        /// <returns>返回操作提示信息</returns>
        public static string deleteDoctor(int id)
        {
            if (service.deleteDoctorById(id))
            {
                return "删除成功";
            }
            else
            {
                return "删除失败";
            }
        }

        /// <summary>
        /// 修改医生信息
        /// </summary>
        /// <param name="departments"></param>
        /// <returns></returns>
        public static string updateDoctor(Doctor doctor)
        {
            if (service.updateDoctor(doctor))
            {
                return "修改成功";
            }
            else
            {
                return "修改失败";
            }
        }

        /// <summary>
        /// 插入一条只有医生姓名的医生信息
        /// </summary>
        /// <param name="doctorName"></param>
        /// <returns></returns>
        public static string insertDoctor(string doctorName)
        {
            if (service.insertDoctor(doctorName))
            {
                return "插入成功";
            }
            else
            {
                return "插入失败";
            }
        }
    }
}
